/**
 * Created by yangfan on 2016/8/29.
 */
define(["require",'config/appregister',"i18n","../../services/httpServices","jquery","domReady","business/library/directives/engDetailDirective"],function(require,app,i18n,httpService){
    app.controller('newsDetailCtrl',function($scope){
        $scope.isDetailPage = true;
        $scope.isMainpage = false;
        $scope.name ="新闻详情页" ;
        $scope.draw = { userPngSrc:"them/images/123.jpg"};
        $scope.i18n = i18n;
        if(localStorage.newsId!=undefined){
            $scope.newsId = localStorage.newsId;
        }
        $scope.breadPath = ["新闻资讯","地铁资讯"];
        $scope.hideAngle = function(index){
            if(index == $scope.breadPath.length-1){
                return true
            }else{
                return false
            }
        };
        $scope.setStyle = function(index){
            return {"border":"1px solid"+"red"}
        };
        //用户评论页面渲染数据
        function getNews (){
            var req = {
                type:"GET",
                uri:"get",
                data:{
                    newsId :$scope.newsId,
                    userId:1
                }
            };
            httpService.getNews(req).success(function(response){
                if(!response.data) return;
                $scope.$apply(function(){
                    $scope.news = response.data;
                })
            });
        };
        function getNewsLike(){
            var req = {
                type:"GET",
                uri:"getLike",
                data:{
                    newsId :$scope.newsId,
                    userId:1,
                    count:6
                }
            };
            httpService.getNewsLike(req).success(function(response){
                if(!response.data) return;
                $scope.$apply(function(){
                    $scope.getLike = response.data;
                })
            });
        }
        getNews();
        getNewsLike();

    })
});

